<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>js 创建虚拟 DOM</title>
</head>

<body>
    <!-- 容器 -->
    <div id="test"></div>

    <!-- react.development 必须在 扩展 dom 之前引入 -->
    <script type="text/javascript" src="../js/react.development.js"></script>
    <script type="text/javascript" src="../js/react-dom.development.js"></script>

    <script type="text/javascript"> 
        // 创建虚拟 DOM 
        // React.createElement('标签名','标签属性（对象）','标签内容')
        // 创建多层虚拟 DOM 
        const VDOM = React.createElement('h1', { id: 'title' }, React.createElement('span',{},'hello world'))
        // const VDOM = React.createElement('h1',{id:'title'},'hello world')
        // 渲染
        ReactDOM.render(
            VDOM,
            document.getElementById('test')
        )
    </script>
</body>

</html>